package com.wiseMen.weixin.main;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class WechatServlet extends HttpServlet {
	
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		this.main(request, response);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		this.main(request, response);
	}
	
	/**
	 * 主体执行方法
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	private void main(HttpServletRequest request, HttpServletResponse response) throws IOException{
		WechatAction myWechat = new WechatAction(request);
		String result = myWechat.execute();
		response.getOutputStream().write(result.getBytes());
	}

	
}